package Test05;

//StringBuilder类的使用
public class test20 {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        //容量：最多装多少
        //长度：已经装了多少
        System.out.println("容量为：" + sb.capacity());
        System.out.println("长度为：" + sb.length());

        System.out.println("====================");

        //sb.append("abc");
        System.out.println("容量为：" + sb.capacity());
        System.out.println("长度为：" + sb.length());

        System.out.println("====================");

        //扩容：原有容量*2+2
        //sb.append("abcdefghijklmnopqrstuvwxyz");
        System.out.println("容量为：" + sb.capacity());
        System.out.println("长度为：" + sb.length());

        System.out.println("====================");

        //超过扩容的容量，以实际为准
        sb.append("abcdefghijklmnopqrstuvwxyz0123456798");
        System.out.println("容量为：" + sb.capacity());
        System.out.println("长度为：" + sb.length());
    }
}
